package numerics;

import java.util.List;

public abstract class Sum {

	static public double sumX(List<double[]> array, int index) {
		double sum = 0.0;
		for (int i = 0; i < array.size(); ++i)
			sum += array.get(i)[index];
		return sum;
	}

	static public double sumX2Pow(List<double[]> array, int index, double exp) {
		double sum = 0.0;
		for (double[] n : array)
			sum += Math.pow(n[index], exp);
		return sum;
	}

	static public double sumXMultY(List<double[]> arrays) {
		double sum = 0.0;
		for (double[] d : arrays)
			sum += d[0] * d[1];
		return sum;
	}
}
